/**
 * @param {number[]} flowerbed
 * @param {number} n
 * @return {boolean}
 */
var canPlaceFlowers = function(flowerbed, n) {
    let kongxi = 0;
    if(flowerbed[0] === 0){
        for(let i = 1;i<flowerbed.length;i++){
            if(flowerbed[i] === 0){
                kongxi++;
            }else{
                kongxi--;
                continue;
            }
        }
    }else{
        for(let i = 2;i<flowerbed.length;i++){
            if(flowerbed[i] === 0){
                kongxi++;
            }else{
                kongxi--;
                continue;
            }
        }
    }
    return kongxi === n
};
flowerbed([1,0,0,0,1],2)